package com.jiyun.controller;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jiyun.common.R.R;
import com.jiyun.common.result.Result;
import com.jiyun.entity.Tavern;
import com.jiyun.service.ITavernService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 23052
 * @since 2025-02-17
 */
@RestController
@RequestMapping("/tavern")
public class TavernController {

    @Autowired
    private ITavernService tavernService;
    //查询所有酒店
    @GetMapping("/findAll")
    public List<Tavern> findTavern(){
        return tavernService.list();
    }
    @GetMapping("/xq")
    public Tavern findTavernById(@RequestParam(name = "tname",required = true) String tname){
        LambdaQueryWrapper<Tavern> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(Tavern::getTname,tname);
        Tavern tavern = tavernService.getOne(wrapper);
        return tavern;
    }

}
